/**
 * 剑指 Offer 17. 打印从1到最大的n位数
 * https://leetcode-cn.com/problems/da-yin-cong-1dao-zui-da-de-nwei-shu-lcof/
 */
const { displayBaseArray } = require('../../libs/public');

/**
 * @param {number} n
 * @return {number[]}
 */
function printNumbers(n) {
  const end = 10 ** n;
  const result = new Array(end - 1).fill(1);
  for (let i = 1; i < end; i += 1) {
    result[i - 1] = i;
  }
  return result;
}

console.log(displayBaseArray(printNumbers(1)) === '[1,2,3,4,5,6,7,8,9]');
